Skip to content

[๐Ÿš€ ์‚ฌ์ดํด2 - ๋ฏธ์…˜ (๋ธ”๋ž™์žญ ๋ฒ ํŒ…)] ๋ชจ์•„ ๋ฏธ์…˜ ์ œ์ถœํ•ฉ๋‹ˆ๋‹ค.#1124

Open
picetea44 wants to merge 49 commits intowoowacourse:picetea44from
picetea44:step2
Open

Conversation

@picetea44
Copy link

@picetea44 picetea44 commented Mar 14, 2026

์ฒดํฌ ๋ฆฌ์ŠคํŠธ

  • ๋ฏธ์…˜์˜ ํ•„์ˆ˜ ์š”๊ตฌ์‚ฌํ•ญ์„ ๋ชจ๋‘ ๊ตฌํ˜„ํ–ˆ๋‚˜์š”?
  • Gradle test๋ฅผ ์‹คํ–‰ํ–ˆ์„ ๋•Œ, ๋ชจ๋“  ํ…Œ์ŠคํŠธ๊ฐ€ ์ •์ƒ์ ์œผ๋กœ ํ†ต๊ณผํ–ˆ๋‚˜์š”?
  • ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์ด ์ •์ƒ์ ์œผ๋กœ ์‹คํ–‰๋˜๋‚˜์š”?

์–ด๋–ค ๋ถ€๋ถ„์— ์ง‘์ค‘ํ•˜์—ฌ ๋ฆฌ๋ทฐํ•ด์•ผ ํ• ๊นŒ์š”?


ํ˜„์žฌ ๊ตฌ์กฐ๋Š” Player โ†’ CardBundle โ†’ Card์ฒ˜๋Ÿผ ๊ฐ์ฒด๊ฐ€ ์„œ๋กœ๋ฅผ ์ฐธ์กฐํ•˜๊ณ  ์žˆ๋Š”๋ฐ, ์ผ๋ถ€ ๋กœ์ง์—์„œ ์ด๋ฏธ Player ๊ฐ์ฒด๋ฅผ ์ „๋‹ฌ๋ฐ›๊ณ  ์žˆ์Œ์—๋„ ๋ถˆ๊ตฌํ•˜๊ณ  CardBundle์— ์ง์ ‘ ์ ‘๊ทผํ•ด ์ ์ˆ˜๋ฅผ ๊ณ„์‚ฐํ•˜๋Š” ์ฝ”๋“œ๊ฐ€ ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.
์ด ๊ฒฝ์šฐ ํŠน์ • ํด๋ž˜์Šค๊ฐ€ ์—ฌ๋Ÿฌ ๋„๋ฉ”์ธ์˜ ๋‚ด๋ถ€ ๊ตฌ์กฐ๋ฅผ ์•Œ๊ณ  ์žˆ์–ด์•ผ ํ•œ๋‹ค๋Š” ์ ์ด ๊ฑธ๋ ธ์Šต๋‹ˆ๋‹ค.
๊ทธ๋ž˜์„œ ์™ธ๋ถ€์—์„œ CardBundle์— ์ง์ ‘ ์ ‘๊ทผํ•˜๋Š” ๋Œ€์‹ , Player์—๊ฒŒ ์ ์ˆ˜๋ฅผ ์š”์ฒญํ•˜๊ณ  Player๊ฐ€ ๋‚ด๋ถ€์ ์œผ๋กœ CardBundle์— ์œ„์ž„ํ•˜๋Š” ๊ตฌ์กฐ๋กœ ๋ณ€๊ฒฝํ–ˆ์Šต๋‹ˆ๋‹ค. ์ด๋ ‡๊ฒŒ ํ•˜๋ฉด ์™ธ๋ถ€์—์„œ๋Š” Player์˜ ๋‚ด๋ถ€ ๊ตฌ์กฐ๋ฅผ ์•Œ ํ•„์š”๊ฐ€ ์—†์–ด์ง€๊ณ , ๋‚˜์ค‘์— ์นด๋“œ ๊ด€๋ฆฌ ๋ฐฉ์‹์ด๋‚˜ ์ ์ˆ˜ ๊ณ„์‚ฐ ๋กœ์ง์ด ๋ฐ”๋€Œ๋”๋ผ๋„ ๋‹ค๋ฅธ ๋„๋ฉ”์ธ์ด๋‚˜ ๋ ˆ์ด์–ด์˜ ๋ณ€๊ฒฝ์„ ์ค„์ผ ์ˆ˜ ์žˆ์ง€ ์•Š์„๊นŒ ์ƒ๊ฐํ–ˆ์Šต๋‹ˆ๋‹ค.
๊ตฌํ˜„์„ ์ง„ํ–‰ํ•˜๋ฉด์„œ ์ด๋Ÿฐ ๋ฐฉ์‹์ด ์œ„์ž„ ๋ฉ”์„œ๋“œ๋ผ๋Š” ๊ฐœ๋…๊ณผ๋„ ์—ฐ๊ฒฐ๋œ๋‹ค๋Š” ๊ฒƒ์„ ์•Œ๊ฒŒ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.
์‚ฌ์ดํด1 ๋ฆฌ๋ทฐ์—์„œ ์ง€์‹์„ ๋ฐ›์•„๊ฐ€๋Š” ์ทจ์ง€๋ณด๋‹ค ์ œ ์ƒ๊ฐ์ด ์ƒ๋Œ€๋ฅผ ์„ค๋“ํ•  ์ˆ˜ ์žˆ์„์ง€์— ์ดˆ์ ์„ ๋งž์ถฐ๋ณด๋ผ๋Š” ๋ง์”€์„ ํ•ด์ฃผ์…จ๋Š”๋ฐ, ์ด๋ฒˆ์—๋Š” ๊ทธ ์กฐ์–ธ์„ ๋– ์˜ฌ๋ฆฌ๋ฉฐ ์ œ ๋‚˜๋ฆ„์˜ ๊ธฐ์ค€์œผ๋กœ ๊ตฌ์กฐ๋ฅผ ์„ ํƒํ•ด ๋ณด์•˜์Šต๋‹ˆ๋‹ค.
์ œ๊ฐ€ ์ด๋Ÿฐ ๋ฐฉํ–ฅ์œผ๋กœ ์ ‘๊ทผํ•œ ๊ฒƒ์ด ์–ด๋А ์ •๋„ ํƒ€๋‹นํ•œ ๋ฐฉํ–ฅ์ธ์ง€, ๋˜ ์ด๋Ÿฐ ์ƒํ™ฉ์—์„œ ์ถ”๊ฐ€๋กœ ๊ณ ๋ คํ•ด ๋ณผ ๋งŒํ•œ ๋ถ€๋ถ„์ด ์žˆ๋Š”์ง€๋„ ์˜๊ฒฌ์„ ๋“ฃ๊ณ  ์‹ถ์Šต๋‹ˆ๋‹ค.

ํŒ์ •๊ณผ ์ˆ˜์ต ๊ณ„์‚ฐ ์ฑ…์ž„ ๋ถ„๋ฐฐ์—์„œ ๊ฒช์€ ์–ด๋ ค์›€๋„ ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.
๋ฒ ํŒ… ๊ธฐ๋Šฅ์„ ๊ตฌํ˜„ํ•˜๋ฉด์„œ ํŒ์ • ๊ฒฐ๊ณผ์™€ ๋ฒ ํŒ… ๊ธˆ์•ก์„ ์ด์šฉํ•ด ์ˆ˜์ต์„ ๊ณ„์‚ฐํ•˜๋Š” ์ฑ…์ž„์„ ์–ด๋””์— ๋‘์–ด์•ผ ํ• ์ง€ ๊ณ ๋ฏผ์ด ๋งŽ์•˜์Šต๋‹ˆ๋‹ค.
์ฒ˜์Œ์—๋Š” ๊ด€๋ จ ์ฑ…์ž„์„ Bet ๋„๋ฉ”์ธ์— ๋ชจ์œผ๋ ค๊ณ  ์ƒ๊ฐํ–ˆ์Šต๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ ๊ตฌํ˜„์„ ์ง„ํ–‰ํ•˜๋ฉด์„œ ํŒ์ • ๋กœ์ง, ํ”Œ๋ ˆ์ด์–ด ์ƒํƒœ, ๋ฒ ํŒ… ๊ธˆ์•ก ๋“ฑ ์—ฌ๋Ÿฌ ๋„๋ฉ”์ธ์ด ํ•จ๊ป˜ ๊ด€์—ฌํ•˜๊ฒŒ ๋˜์—ˆ๊ณ , ์–ด๋А ๊ฐ์ฒด์— ์ฑ…์ž„์„ ๋‘๋Š” ๊ฒƒ์ด ์ž์—ฐ์Šค๋Ÿฌ์šด์ง€ ํŒ๋‹จํ•˜๊ธฐ๊ฐ€ ์‰ฝ์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค.
๊ทธ๋ž˜์„œ ์—ฌ๋Ÿฌ ๋ฐฉํ–ฅ์œผ๋กœ ๊ตฌ์กฐ๋ฅผ ๋ฐ”๊ฟ” ๋ณด๋ฉด์„œ ๊ณ„์† ์ˆ˜์ •์„ ์ง„ํ–‰ํ–ˆ๋˜ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค. ๊ทธ ๊ณผ์ •์—์„œ ํŠน์ • ๊ฐ์ฒด๊ฐ€ ๋„ˆ๋ฌด ๋งŽ์€ ์ •๋ณด๋ฅผ ์•Œ๊ฒŒ ๋˜๋Š” ๊ตฌ์กฐ๊ฐ€ ๋˜๊ธฐ๋„ ํ–ˆ๊ณ , ๋ฐ˜๋Œ€๋กœ ์ฑ…์ž„์ด ์ง€๋‚˜์น˜๊ฒŒ ๋ถ„์‚ฐ๋˜๋Š” ๋А๋‚Œ๋„ ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.
์—ฌ๋Ÿฌ ์‹œ๋„๋ฅผ ๊ฑฐ์นœ ๋์— ํ˜„์žฌ ๊ตฌ์กฐ๋ฅผ ์„ ํƒํ•˜๊ฒŒ ๋˜์—ˆ์ง€๋งŒ, ์ด ์„ ํƒ์ด ์ตœ์„ ์ธ์ง€์— ๋Œ€ํ•ด์„œ๋Š” ์•„์ง ํ™•์‹ ์ด ์„œ์ง€๋Š” ์•Š์Šต๋‹ˆ๋‹ค.
์•„๋ฃจ๊ฐ€ ๋ณด์‹œ๊ธฐ์—๋Š” ์ด ๋ฌธ์ œ๋ฅผ ๊ณ ๋ฏผํ•˜๋Š” ๊ณผ์ •์—์„œ ์ œ๊ฐ€ ๋†“์น˜๊ณ  ์žˆ๋Š” ๋ถ€๋ถ„์ด ์žˆ๋Š”์ง€, ํ˜น์€ ์ด๋Ÿฐ ์ƒํ™ฉ์—์„œ ์ฑ…์ž„์˜ ์œ„์น˜๋ฅผ ํŒ๋‹จํ•  ๋•Œ ์–ด๋–ค ๊ธฐ์ค€์œผ๋กœ ์ ‘๊ทผํ•˜์‹œ๋Š”์ง€ ๊ถ๊ธˆํ•ฉ๋‹ˆ๋‹ค.


๊ทธ๋ฆฌ๊ณ  ์ง€๋‚œ ๋ฆฌ๋ทฐ์—์„œ ์ข‹์€ ํ”ผ๋“œ๋ฐฑ์„ ๋งŽ์ด ๋‚จ๊ฒจ์ฃผ์…”์„œ ๊ฐ์‚ฌํ–ˆ์Šต๋‹ˆ๋‹ค. ๋‹จ์ˆœํžˆ ์ˆ˜์ •ํ•  ๋ถ€๋ถ„์„ ์งš์–ด์ฃผ์‹œ๋Š” ๊ฒƒ๋ฟ๋งŒ ์•„๋‹ˆ๋ผ, ์–ด๋–ค ๊ด€์ ์—์„œ ๊ณ ๋ฏผํ•ด๋ณด๋ฉด ์ข‹์„์ง€๊นŒ์ง€ ๋ง์”€ํ•ด์ฃผ์…”์„œ ์ด๋ฒˆ ์‚ฌ์ดํด์„ ์ง„ํ–‰ํ•˜๋ฉด์„œ ์—ฌ๋Ÿฌ ๋ฒˆ ๋‹ค์‹œ ๋– ์˜ฌ๋ฆฌ๊ฒŒ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ๋•๋ถ„์— ์ด๋ฒˆ์—๋Š” ์ด์ „๋ณด๋‹ค ์„ค๊ณ„์— ๋Œ€ํ•ด ์กฐ๊ธˆ ๋” ๊นŠ๊ฒŒ ๊ณ ๋ฏผํ•ด๋ณด๋ ค๊ณ  ๋…ธ๋ ฅํ–ˆ์Šต๋‹ˆ๋‹ค.

์•„์ง ์ œ๊ฐ€ ๋†“์น˜๊ณ  ์žˆ๋Š” ๋ถ€๋ถ„๋„ ๋งŽ์„ ๊ฒƒ ๊ฐ™๊ณ , ๋ฐฉํ–ฅ์ด ์™„์ „ํžˆ ๋งž๋Š”์ง€์— ๋Œ€ํ•œ ํ™•์‹ ๋„ ๋ถ€์กฑํ•œ ์ƒํƒœ์ด์ง€๋งŒ ๊ทธ๋ž˜๋„ ๋‚˜๋ฆ„๋Œ€๋กœ ์ƒ๊ฐํ•ด๋ณธ ๊ณผ์ •๋“ค์„ ์ •๋ฆฌํ•ด๋ณด์•˜์Šต๋‹ˆ๋‹ค. ์ด๋ฒˆ์—๋„ ๋ถ€์กฑํ•œ ๋ถ€๋ถ„์ด ์žˆ๋‹ค๋ฉด ํŽธํ•˜๊ฒŒ ๋ง์”€ํ•ด์ฃผ์‹œ๋ฉด ๊ฐ์‚ฌํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค. ์ž˜ ๋ถ€ํƒ๋“œ๋ฆฝ๋‹ˆ๋‹ค.๐Ÿ˜Š

kcnsmoothie and others added 30 commits March 5, 2026 11:21
@donghoony donghoony self-requested a review March 15, 2026 07:11
Copy link
Member

@donghoony donghoony left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์•ˆ๋…•ํ•˜์„ธ์š” ๋ชจ์•„! ์ €๋ฒˆ ์‚ฌ์ดํด์—์„œ๋„ ๋А๊ผˆ์ง€๋งŒ ๊ฐ„๋‹จ๋ช…๋ฃŒํ•˜๊ณ  ์‰ฝ๊ฒŒ ์ฝ”๋“œ๋ฅผ ์ž‘์„ฑํ•˜๊ณ  ๊ณ„์‹œ๋‹ค๊ณ  ๋А๋‚๋‹ˆ๋‹ค. ์ฝ๊ธฐ ์‰ฌ์›Œ์„œ ๋ฆฌ๋ทฐํ•  ๊ณณ์ด ์ž˜ ๋ณด์˜€์–ด์š”.

๋งˆ๊ฐ๊ธฐํ•œ์ด ์–ธ์ œ๊นŒ์ง€์ธ์ง€๋Š” ์ž˜ ๋ชจ๋ฅด๊ฒ ์ง€๋งŒ, ์šฐ์„  RC๋ฅผ ๋“œ๋ ค์š”. ์„ ํƒ์ ์œผ๋กœ ๋ฐ˜์˜ํ•  ๊ฒƒ์€ ํฌ๊ธฐ๊ฐ€ ์ปค์งˆ ์ˆ˜ ์žˆ์–ด ๊ฐ™์ด ์ด์•ผ๊ธฐํ•˜๋Š” ๊ฒƒ๋งŒ์œผ๋กœ๋„ ์ถฉ๋ถ„ํ•  ๊ฒƒ ๊ฐ™์•„์š”.

์ฝ”๋ฉ˜ํŠธ๋กœ ์ด์•ผ๊ธฐ ์ด์–ด๋‚˜๊ฐ€๋ณด์‹œ์ฃ !


private final double profitRate;

Outcome(double profitRate) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default ์ƒ์„ฑ์ž๋กœ ์ž‘์„ฑํ•ด์ฃผ์‹  ์ด์œ ๊ฐ€ ์žˆ์„๊นŒ์š”?

import java.util.Map;

public class ProfitResult {
private final Map<Player, Integer> playerProfits;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Player๋ฅผ ํ‚ค๋กœ ์‚ฝ์ž…ํ•ด์ฃผ์…จ๋„ค์š”. ์žŠ์€ ๊ฒƒ์€ ์—†์„๊นŒ์š”? ๐Ÿ‘€

Comment on lines +18 to +22
int dealerProfit = 0;
for (int profit : playerProfits.values()) {
dealerProfit -= profit;
}
return dealerProfit;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stream ์—ฐ์‚ฐ์„ ์—ฐ์Šตํ•ด๋ณด๊ณ  ์ ์šฉํ•ด๋ณผ๊นŒ์š”?

import domain.game.Outcome;

public class BettingMoney {
private final int amount;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๋ฒ ํŒ…๊ธˆ์•ก์ด ํ™€์ˆ˜๊ฐ€ ๋˜๋ฉด ์–ด๋–ป๊ฒŒ ๋ ๊นŒ์š”?

Comment on lines +13 to +17
private void validate(int amount) {
if (amount <= 0) {
throw new IllegalArgumentException("๋ฒ ํŒ… ๊ธˆ์•ก์ด 0์ดํ•˜ ์ผ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.");
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๋ธ”๋ž™์žญ์—์„œ ์“ฐ์ด๋Š” ๋ˆ์„ ์ž˜ ๊ฒ€์ฆํ•ด์ฃผ์…จ๋„ค์š” ๐Ÿ‘๐Ÿป

@Test
void ๋”œ๋Ÿฌ_์ˆ˜์ต์€_ํ”Œ๋ ˆ์ด์–ด_์ˆ˜์ต_ํ•ฉ์‚ฐ์˜_๋ถ€ํ˜ธ_๋ฐ˜์ „์ด๋‹ค() {
Map<Player, Integer> playerProfits = new LinkedHashMap<>();
playerProfits.put(new Player("pobi", new BettingMoney(10000)), 10000);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ํฐ ์ˆ˜์˜ ๋‹จ์œ„๋Š” _๋กœ ๊ตฌ๋ถ„ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. 10_000์œผ๋กœ ์ž‘์„ฑํ•˜๋ฉด ๊ฐ€๋…์„ฑ์„ ๋” ์ฑ™๊ธธ ์ˆ˜ ์žˆ๊ฒ ๋„ค์š”!

์ฒ˜์Œ์—๋Š” ๊ด€๋ จ ์ฑ…์ž„์„ Bet ๋„๋ฉ”์ธ์— ๋ชจ์œผ๋ ค๊ณ  ์ƒ๊ฐํ–ˆ์Šต๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ ๊ตฌํ˜„์„ ์ง„ํ–‰ํ•˜๋ฉด์„œ ํŒ์ • ๋กœ์ง, ํ”Œ๋ ˆ์ด์–ด ์ƒํƒœ, ๋ฒ ํŒ… ๊ธˆ์•ก ๋“ฑ ์—ฌ๋Ÿฌ ๋„๋ฉ”์ธ์ด ํ•จ๊ป˜ ๊ด€์—ฌํ•˜๊ฒŒ ๋˜์—ˆ๊ณ , ์–ด๋А ๊ฐ์ฒด์— ์ฑ…์ž„์„ ๋‘๋Š” ๊ฒƒ์ด ์ž์—ฐ์Šค๋Ÿฌ์šด์ง€ ํŒ๋‹จํ•˜๊ธฐ๊ฐ€ ์‰ฝ์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค.
๊ทธ๋ž˜์„œ ์—ฌ๋Ÿฌ ๋ฐฉํ–ฅ์œผ๋กœ ๊ตฌ์กฐ๋ฅผ ๋ฐ”๊ฟ” ๋ณด๋ฉด์„œ ๊ณ„์† ์ˆ˜์ •์„ ์ง„ํ–‰ํ–ˆ๋˜ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค. ๊ทธ ๊ณผ์ •์—์„œ ํŠน์ • ๊ฐ์ฒด๊ฐ€ ๋„ˆ๋ฌด ๋งŽ์€ ์ •๋ณด๋ฅผ ์•Œ๊ฒŒ ๋˜๋Š” ๊ตฌ์กฐ๊ฐ€ ๋˜๊ธฐ๋„ ํ–ˆ๊ณ , ๋ฐ˜๋Œ€๋กœ ์ฑ…์ž„์ด ์ง€๋‚˜์น˜๊ฒŒ ๋ถ„์‚ฐ๋˜๋Š” ๋А๋‚Œ๋„ ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.
์—ฌ๋Ÿฌ ์‹œ๋„๋ฅผ ๊ฑฐ์นœ ๋์— ํ˜„์žฌ ๊ตฌ์กฐ๋ฅผ ์„ ํƒํ•˜๊ฒŒ ๋˜์—ˆ์ง€๋งŒ, ์ด ์„ ํƒ์ด ์ตœ์„ ์ธ์ง€์— ๋Œ€ํ•ด์„œ๋Š” ์•„์ง ํ™•์‹ ์ด ์„œ์ง€๋Š” ์•Š์Šต๋‹ˆ๋‹ค.
์•„๋ฃจ๊ฐ€ ๋ณด์‹œ๊ธฐ์—๋Š” ์ด ๋ฌธ์ œ๋ฅผ ๊ณ ๋ฏผํ•˜๋Š” ๊ณผ์ •์—์„œ ์ œ๊ฐ€ ๋†“์น˜๊ณ  ์žˆ๋Š” ๋ถ€๋ถ„์ด ์žˆ๋Š”์ง€, ํ˜น์€ ์ด๋Ÿฐ ์ƒํ™ฉ์—์„œ ์ฑ…์ž„์˜ ์œ„์น˜๋ฅผ ํŒ๋‹จํ•  ๋•Œ ์–ด๋–ค ๊ธฐ์ค€์œผ๋กœ ์ ‘๊ทผํ•˜์‹œ๋Š”์ง€ ๊ถ๊ธˆํ•ฉ๋‹ˆ๋‹ค.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ฝ”๋“œ๋ฅผ ์ฝ๋Š”๋ฐ์—๋Š” ์ „ํ˜€ ๋ถˆํŽธํ•˜์ง€ ์•Š์•˜๊ณ , ์š”๊ตฌ์‚ฌํ•ญ ์ถ”๊ฐ€์— ๋งž๊ฒŒ ์ž˜ ๋ฐœ์ „์‹œ์ผœ์ฃผ์…จ๋‹ค๊ณ  ์ƒ๊ฐํ•ด์š”. ๊ถ๊ธˆํ•œ ๋‚ด์šฉ์€ ๊ฐ ์ฝ”๋ฉ˜ํŠธ์— ๋‚จ๊ฒจ๋‘๊ฒ ์Šต๋‹ˆ๋‹ค. ๐Ÿ‘๐Ÿป

๋ฏธ์…˜ ์ดˆ๊ธฐ, ์ „์ฒด์ ์ธ ์„ค๊ณ„๊ฐ€ ๋จธ๋ฆฟ์†์— ์™„๋ฒฝํžˆ ๊ทธ๋ ค์ง€์ง€ ์•Š์€ ์ƒํƒœ์—์„œ TDD๋ฅผ ์‹œ์ž‘ํ•˜๋ ค๋‹ˆ ์ƒ๋‹นํ•œ ๋ง‰๋ง‰ํ•จ์„ ๋А๊ผˆ์Šต๋‹ˆ๋‹ค. ๋™์ž‘์„ ๊ธฐ์ค€์œผ๋กœ ํ…Œ์ŠคํŠธ๋ฅผ ์ž‘์„ฑํ•˜๋ฉฐ ์ƒํ–ฅ์‹์œผ๋กœ ์ ‘๊ทผํ•˜๋ ค ํ–ˆ์œผ๋‚˜, ์—ฌ๋Ÿฌ ๊ฐ์ฒด๋‚˜ ๋ฉ”์„œ๋“œ๊ฐ€ ๋ณต์žกํ•˜๊ฒŒ ์ƒํ˜ธ์ž‘์šฉํ•ด์•ผ ํ•˜๋Š” ์ƒํ™ฉ์—์„œ๋Š” ๊ทธ ๋™์ž‘์˜ ๋‹จ์œ„ ์ž์ฒด๊ฐ€ ๋ชจํ˜ธํ•˜๊ฒŒ ๋‹ค๊ฐ€์™”์Šต๋‹ˆ๋‹ค.
ํ˜„์žฌ ๊ตฌ์กฐ๋Š” Player โ†’ CardBundle โ†’ Card์ฒ˜๋Ÿผ ๊ฐ์ฒด๊ฐ€ ์„œ๋กœ๋ฅผ ์ฐธ์กฐํ•˜๊ณ  ์žˆ๋Š”๋ฐ, ์ผ๋ถ€ ๋กœ์ง์—์„œ ์ด๋ฏธ Player ๊ฐ์ฒด๋ฅผ ์ „๋‹ฌ๋ฐ›๊ณ  ์žˆ์Œ์—๋„ ๋ถˆ๊ตฌํ•˜๊ณ  CardBundle์— ์ง์ ‘ ์ ‘๊ทผํ•ด ์ ์ˆ˜๋ฅผ ๊ณ„์‚ฐํ•˜๋Š” ์ฝ”๋“œ๊ฐ€ ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.
์ด ๊ฒฝ์šฐ ํŠน์ • ํด๋ž˜์Šค๊ฐ€ ์—ฌ๋Ÿฌ ๋„๋ฉ”์ธ์˜ ๋‚ด๋ถ€ ๊ตฌ์กฐ๋ฅผ ์•Œ๊ณ  ์žˆ์–ด์•ผ ํ•œ๋‹ค๋Š” ์ ์ด ๊ฑธ๋ ธ์Šต๋‹ˆ๋‹ค.
๊ทธ๋ž˜์„œ ์™ธ๋ถ€์—์„œ CardBundle์— ์ง์ ‘ ์ ‘๊ทผํ•˜๋Š” ๋Œ€์‹ , Player์—๊ฒŒ ์ ์ˆ˜๋ฅผ ์š”์ฒญํ•˜๊ณ  Player๊ฐ€ ๋‚ด๋ถ€์ ์œผ๋กœ CardBundle์— ์œ„์ž„ํ•˜๋Š” ๊ตฌ์กฐ๋กœ ๋ณ€๊ฒฝํ–ˆ์Šต๋‹ˆ๋‹ค. ์ด๋ ‡๊ฒŒ ํ•˜๋ฉด ์™ธ๋ถ€์—์„œ๋Š” Player์˜ ๋‚ด๋ถ€ ๊ตฌ์กฐ๋ฅผ ์•Œ ํ•„์š”๊ฐ€ ์—†์–ด์ง€๊ณ , ๋‚˜์ค‘์— ์นด๋“œ ๊ด€๋ฆฌ ๋ฐฉ์‹์ด๋‚˜ ์ ์ˆ˜ ๊ณ„์‚ฐ ๋กœ์ง์ด ๋ฐ”๋€Œ๋”๋ผ๋„ ๋‹ค๋ฅธ ๋„๋ฉ”์ธ์ด๋‚˜ ๋ ˆ์ด์–ด์˜ ๋ณ€๊ฒฝ์„ ์ค„์ผ ์ˆ˜ ์žˆ์ง€ ์•Š์„๊นŒ ์ƒ๊ฐํ–ˆ์Šต๋‹ˆ๋‹ค.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ข‹์€ ์ ‘๊ทผ์ด๋„ค์š”. Tell, Don't Ask ๋ผ๋Š” ์ด์•ผ๊ธฐ๋„ ๊ฒฐ๊ตญ์—๋Š” ์—ฌ๋Ÿฌ ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๊ธฐ ์œ„ํ•ด ๋‚˜์™”๋‹ค๊ณ  ์ƒ๊ฐํ•ด์š”. ๋ณ€๊ฒฝ๋˜๋Š” ๊ฒƒ๊ณผ ๊ทธ๋ ‡์ง€ ์•Š์€ ๊ฒƒ, ๋ณ€๊ฒฝ๋œ๋‹ค๊ณ  ํ•˜๋ฉด ๊ทธ ์ „ํŒŒ๋ฅผ ์ตœ์†Œํ™”ํ•˜๋Š” ๋ฐฉํ–ฅ์„ ๊พธ์ค€ํžˆ ๊ณ ๋ฏผํ•ด๋ณด์‹œ๋Š” ๊ฒŒ ์ข‹์Šต๋‹ˆ๋‹ค! ์ด๋•Œ ๋” ์ค‘์š”ํ•œ ๊ฑด ๋‹ค๋ฅธ ํŒ€์›๋“ค์—๊ฒŒ ๋‚˜์˜ ์ฃผ์žฅ์„ ์ž˜ ์„ค๋“ํ•˜๋Š” ๋ฐฉ๋ฒ•์ด๊ฒ ๋„ค์š”.

for (Player player : players.getGamePlayers()) {
player.addCard(deck.draw());
private void dealInitialTwoCards(Dealer dealer, Players players, Deck deck) {
for (int i = 0; i < 2; i++) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2๋Š” ๋ธ”๋ž™์žญ์—์„œ ์˜๋ฏธ๋ฅผ ๊ฐ€์ง€๋Š” ์ˆ˜๋„ค์š”!


import domain.game.Outcome;

public class BettingMoney {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new BettingMoney(100).equals(new BettingMoney(100))์˜ ๊ฒฐ๊ณผ๋Š” ์–ด๋–ค๊ฐ€์š”?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants